package com.zhangtai.modules.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhangtai.modules.dto.ScoreProgramDto;
import com.zhangtai.modules.entity.score.ScoreProgramEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2020-10-14 15:03:55
 */
@Mapper
public interface ScoreProgramDao extends BaseMapper<ScoreProgramEntity> {

    @Select("<script>   SELECT\n" +
            "\ttsp.*,\n" +
            "\ttsw.superior_weights,\n" +
            "\ttsw.same_level_weights,\n" +
            "\ttsw.subordinate_weights,\n" +
            "\ttsw.my_weights,\n" +
            "\ttsw.weights_name \n" +
            "FROM\n" +
            "\ttb_score_program tsp\n" +
            "\tLEFT JOIN tb_score_weights tsw ON tsp.weights_id = tsw.id " +
            " <where> tsp.is_delete = 0 \n" +
            "</where> ORDER BY tsp.create_time DESC" +
            "</script>")
    public List<ScoreProgramDto> getScoreProgramPage(Page<ScoreProgramDto> page);


}
